# 0
# no

# 1
d = dict()
d['name'] = 'aa'
print(d['name'])

# 直接赋值

# 2


# 3
# 无类型限制

# 4
dict1 = {}
print(dict1.fromkeys((1, 2, 3), ('one', 'two', 'three')))

# 5
dict2 = {1: 'one', 2: 'two', 3: 'three'}
dict3 = dict2.copy()
print(dict3)




users = dict()
pwd = 'pwd'

# 动手吧

def new_user():
    notice = '请输入用户名：'
    while 1:
        username = input(notice)

        if username in users:
            notice = '此用户名已被使用，请重新输入：'
            continue
        else:
            break
    pwd = input('请输入密码：')
    users[username] = pwd
    print('注册成功，赶紧试试登录吧')

def login():
    notice = '请输入用户名：'
    while True:
        name = input(notice)
        if name not in users:
            notice = '您输入的用户名不存在，请重新输入：'
            continue
        else:
            break
    pwd = input('请输入密码：')
    truepwd = users.get(name)
    if pwd == truepwd:
        print('欢饮进入xxoo，请关闭')
    else:
        print('密码错误')


while True:
    print('--- 新建用户：N/n ---')
    print('--- 登录账号：E/e ---')
    print('--- 退出程序：Q/q ---')
    code = str(input('请输入指令代码'))

    if code.isalpha():
        code = code.lower()
    else:
        continue

    if code == 'n':
        new_user()
    elif code == 'e':
        login()
    elif code == 'n':
        break
    else:
        pass

